package com.cn.wanxi.servlet.front;

import com.alibaba.fastjson.JSONObject;
import com.cn.wanxi.model.ResultModel;
import com.cn.wanxi.service.AboutCompanyNameService;
import com.cn.wanxi.service.AboutDesignerService;
import com.cn.wanxi.service.impl.AboutCompanyNameServiceImpl;
import com.cn.wanxi.service.impl.AboutDesignerServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

@WebServlet("/about/companyName")
public class AboutCompanyNameServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //      0.乱码解决
        req.setCharacterEncoding("UTF-8");
        resp.setCharacterEncoding("UTF-8");
        //3.调用服务逻辑层
        ResultModel resultModel =new ResultModel();
        Map map=new HashMap();
        AboutCompanyNameService aboutCompanyNameService = new AboutCompanyNameServiceImpl();
        map.put("AboutCompanyName",aboutCompanyNameService.getAboutCompanyName());
        resultModel.setData(map);
        //4.返回前端需要的数据
        resp.getWriter().print(JSONObject.toJSONString(resultModel));
    }
}
